package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.util.vantClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ResCategoryMapper;
import com.ruoyi.system.domain.ResCategory;
import com.ruoyi.system.service.IResCategoryService;

/**
 * 餐馆分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-29
 */
@Service
public class ResCategoryServiceImpl implements IResCategoryService 
{
    @Autowired
    private ResCategoryMapper resCategoryMapper;

    /**
     * 查询餐馆分类
     * 
     * @param categoryId 餐馆分类主键
     * @return 餐馆分类
     */
    @Override
    public ResCategory selectResCategoryByCategoryId(Long categoryId)
    {
        return resCategoryMapper.selectResCategoryByCategoryId(categoryId);
    }

    /**
     * 查询餐馆分类列表
     * 
     * @param resCategory 餐馆分类
     * @return 餐馆分类
     */
    @Override
    public List<ResCategory> selectResCategoryList(ResCategory resCategory)
    {
        return resCategoryMapper.selectResCategoryList(resCategory);
    }

    @Override
    public ResCategory selectResCategoryByCategoryName(String categoryName) {
        ResCategory resCategory = new ResCategory();
        resCategory.setCategoryName(categoryName);
        List<ResCategory> list = resCategoryMapper.selectResCategoryList(resCategory);
        return list.isEmpty() ? null : list.get(0);
    }

    /**
     * 新增餐馆分类
     * 
     * @param resCategory 餐馆分类
     * @return 结果
     */
    @Override
    public int insertResCategory(ResCategory resCategory)
    {
        return resCategoryMapper.insertResCategory(resCategory);
    }

    /**
     * 修改餐馆分类
     * 
     * @param resCategory 餐馆分类
     * @return 结果
     */
    @Override
    public int updateResCategory(ResCategory resCategory)
    {
        return resCategoryMapper.updateResCategory(resCategory);
    }

    /**
     * 批量删除餐馆分类
     * 
     * @param categoryIds 需要删除的餐馆分类主键
     * @return 结果
     */
    @Override
    public int deleteResCategoryByCategoryIds(Long[] categoryIds)
    {
        return resCategoryMapper.deleteResCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除餐馆分类信息
     * 
     * @param categoryId 餐馆分类主键
     * @return 结果
     */
    @Override
    public int deleteResCategoryByCategoryId(Long categoryId)
    {
        return resCategoryMapper.deleteResCategoryByCategoryId(categoryId);
    }

    @Override
    public List<vantClass> selectResCategoryListVant() {
        return resCategoryMapper.selectResCategoryListForVant();
    }
}
